#ifndef COMPRESSEDDATA_H_
#define COMPRESSEDDATA_H_

#include "bitstream.h"
#include <string>
#include <vector>

class CompressedData
{
protected:
	std::string path;
	CompressedData(std::string& path);
	CompressedData(std::string& path, int M, int wordSize,
			std::vector<int> &dictionary, int lastSize);

public:
	int M;
	int wordSize;
	BitStream data;
	std::vector<int> dictionary;
	int lastSize;
};

class CompressedDataInput: public CompressedData
{
public:
	bool END()
	{
		return data.END;
	}
	int pos()
	{
		return data.pos;
	}
	int length()
	{
		return data.length();
	}
	CompressedDataInput(std::string& path);
	int get();
};

class CompressedDataOutput: public CompressedData
{
public:

	CompressedDataOutput(std::string& path, int M, int wordSize,
			std::vector<int> &dictionary, int lastSize);
	void put(int bit);
	void commit();
};

#endif /* COMPRESSEDDATA_H_ */
